﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Business;
using Domain;
using System.Web.Configuration;
using CrystalReports;
using System.IO;

namespace HotelBrisaYArenaAdministrador
{
    public partial class DisponibilidadDiaHabitacion : System.Web.UI.Page
    
    {

        protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
        private CrystalReport1 report = new CrystalReport1();
        HabitacionBusiness habitacionBusiness = new HabitacionBusiness(WebConfigurationManager.ConnectionStrings["ApplicationServices"].ToString());

        protected void Page_Load(object sender, EventArgs e)
        {
 
                DateTime fechaActual = new DateTime();
                fechaActual = DateTime.Today;
                DateTime fechaLlegada = fechaActual;
                LinkedList<Habitacion> habitaciones = new LinkedList<Habitacion>();
                habitaciones = habitacionBusiness.ObtenerHabitaciones();
                Repetidor2.DataSource = habitaciones;
                Repetidor2.DataBind();


                CrystalReportViewer1.ReportSource = report;
                CrystalReportViewer1.Visible = false;
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            MemoryStream oStream; // using System.IO
            oStream = (MemoryStream)
            report.ExportToStream(
            CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "application/pdf";
            Response.BinaryWrite(oStream.ToArray());
            Response.End();
        }


    }
}